CAPBAR.VBX Custom Control. Overview. CAPBAR.VBX is a Visual BasicO custom control that allows your VB application to place a toolbar on the caption bar of any window. This toolbar will only be displayed on the active window and will `follow' the user around as they jump from window to window. The windows that the toolbar displays on can be restricted at the window level, task level or window class level. NOTE. CAPBAR.VBX is shareware. It costs $10 to register. Registered users receive the latest version plus the source code. Properties. NumButtons Description Determines how many buttons are on the toolbar. The maximum is 10. Datatype: Integer Remarks. Read\Write at design time, read only at run time ButtonStatus Description. Determines whether a button is enabled or disabled. The button to set is determined from the ButtonIndex property. Datatype Integer Settings: 0 - Enabled 1 - Disabled. Example: Capbar.ButtonIndex = 2 ` Second button on the toolbar CapBar.ButtonStatus = 1 ` disable it. Remarks. The button in redrawn using the .BMP supplied for the ButtonDisabled property. If no value was given for this property then the buttonup .BMP is used. A tooltip will display for a disabled button but no click event will be generated. ButtonClass Description If set specifies the windows classname that you want the toolbar to show for. Any window that was created using this class will have the toolbar displayed when it becomes active. Datatype String Example. Capbar.ButonClass = "ThunderForm" ` any visual basic form CapBar.action = 0 ` activate the toolbar. ButtonFormHwnd Description. If set specifies which window will have the toolbar. Datatype Integer Remarks. Not available at design time. Example: CapBar.buttonformhwnd = me.hwnd capbar.action = 0 ButtonTask Description If set specifies a task All windows belonging to that task will have a toolbar. Datatype Integer Remarks Use the special value of -1 to display a toolbar on all windows. Example capbar.butttontask = -1 ` all windows capbar.action = 0 capbar.buttontask = GetCurrentTask( ) ` use windows API ` display toolbar on all windows created by me capbar.action = 0 Action Description Activates and display the toolbar based on the current criteria or removes it. Datatype Integer Remarks. a setting of 0 activates the toolbar a value of 1 deactivates it. Example. capbar.action = 0 ` activate the toolbar ButtonIndex Description Determines which of the buttons properties you are modifying or interrogating. Datatype Integer Remarks Must be less than the NumButtons property. Example Capbar.buttonIndex = 3 ` changing button 3 capbar.buttonTip = "Hello World" ` set it's tip ButtonUp Description Determines what displays on the toolbar when the button is in the `up' state. Datatype Picture Remarks This version of CAPBAR.VBX only supports bitmaps. The value of ButtonIndex is used to determine which button you are modifying. Example. capbar.buttonindex = 1 capbar.buttonup = loadpicture("my.bmp") ButtonDown Description Determines what displays on the toolbar when the button is pressed. Datatype Picture Remarks This version of CAPBAR.VBX only supports bitmaps. The value of ButtonIndex is used to determine which button you are modifying. Example. capbar.buttonindex = 1 capbar.buttonDown = loadpicture("my.bmp") ButtonDisabled Description Determines what displays on the toolbar when the button is disabled. Datatype Picture Remarks This version of CAPBAR.VBX only supports bitmaps. The value of ButtonIndex is used to determine which button you are modifying. Example. capbar.buttonindex = 1 capbar.buttonDisabled = loadpicture("my.bmp") capbar.buttonstatus = 1 ` disable it. ButtonAlign Description Determines the alignment of the toolbar on the windows caption. Datatype Integer Remarks Set this property to 0 to align the toolbar on the left side of the windows caption. Set it to 1 to align it on the right. Example capbar.buttonalign = 1 ButtonTip Description Specifies the "tip" to be displayed as the cursor moves over the button. Datatype String Remarks Tips are displayed for both enabled and disabled buttons. The buttonIndex property is used to determine which button is being set. Example CapBar.ButtonIndex = 4 CapBar.ButtonTip = "Hello" Design Mode. The first step in design mode is to set the numbuttons property. After that adjust the buttonindex property from 1 to numbuttons and set the buttonup, ButtonDown, ButtonDisabled, ButtonStatus and ButtonTip property for each one. If you want this toolbar to show on all windows then set ButtonTask to -1. If you want this toolbar to appear on all windows with a certain class set the ButtonClass property. Where the Toolbar shows. The properties ButtonTask, ButtonClass and ButtonFormHwnd are interrogated to determine whether a toolbar should be displayed on a window. Only one of these properties should be set. If you want the toolbar to only show on one particular window then use the ButtonFormHwnd property and assign it the hwnd of the window you want it to appear on. e.g. CapBar.buttonformhwnd = me.hwnd or CapBar.buttonformhwnd = form1.Hwnd. To have the toolbar show on all windows that were created from the same class use the ButtonClass property. e.g. setting this property to "ThunderForm" will display the toolbar on any Visual Basic form. The toolbar follows the user as they jump from window to window. Events. The control supports one event. This is the click event and is triggered when the user presses and releases a button. The event is passed one parameter which is the index of the button that was pressed. This index starts at 1. Button 1 is the left most one on the toolbar. Demo The program DEMO.EXE shows a simple VB application that uses CAPBAR.VBX. This demo will put a toolbar with two buttons on the VB design time debug window. Clicking the first button will clear the contents of the debug window. Clicking the second will print the contents of the debug window. The ButtonClass property is set to OFEDT, which is the window classname for the debug window. Registering. You can register this product for $10. You will receive the source code for CAPBAR.VBX and the latest version of the product. You can register in one of two ways. 1. Send $10 made payable to Steve Bridges to: 76 Nash St. 2nd Floor New Haven CT 06511 2. GO SWREG on CompuServe. Getting Help You can contact me on : CompuServe 71507,1033 AOL STEVEB3091 FAX 203-865-2250 Suggestions and comments are welcome. Steve Bridges